package com.tdk.bts.service;

import com.tdk.bts.dao.FilmServiceDao;
import com.tdk.bts.entity.Film;
import com.tdk.bts.util.Page;
import java.sql.*;
import java.util.List;


public class FilmServiceImp implements FilmService {
    private FilmServiceDao filmServiceDao= new FilmServiceDao();
    @Override
    public Page<Film> findAllFilms(int page) throws SQLException {
        int count = filmServiceDao.FilmTotalCount();
        List<Film> filmList = filmServiceDao.findFilms(page);
        Page<Film> films = new Page<Film>(page, 8, filmList, count);
        return films;
    }
    @Override
    public void addFilms(List<Film> films) throws SQLException {
      filmServiceDao.addFilms(films);
    }

    @Override
    public void removeFilms(String ids) throws SQLException {
      filmServiceDao.removeFilms(ids);
    }
}
